#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <ncurses.h>
#include <iostream>
#include <signal.h>
#include <unistd.h>
#include <vector>
#include <string>
#include <menu.h>

using namespace std;

class MainWindow {
public:

	vector<string> visibleItems = {};
    vector<string> currentItems = {};
	vector<string> menuItems    = {};

    string searchQuery  = "";
    bool isSearch       = true;
	
    wchar_t currentItem = 0;
	int lastItem        = 0;

	char *statusText;
	
    WINDOW *win         = nullptr;
	bool terminated     = false;
	
    int screen          = 0;
	int lastKey         = 0;
	int indent          = 3;
	int scrollTop       = 0;
	int maxRows         = 0;
	int maxX            = 0;
	int maxY            = 0;

	MainWindow(vector<string> &items);
	void moveUp();
	void moveDown();
	
    string searchKeys();
    string defaultKeys();
    vector<string> process();
	
    void drawBody();
	void drawStatus();
    void drawSearch();
	void drawMainScreen();
    
    void toggleMode();
    void turnStdMode();
	
    vector<string> initWindow();
	vector<string> getVisibleItems();
	void clearLine(int y, int l);
};

#endif // MAINWINDOW_H




